/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package STUDENT.NGUYENSANG.OOPs.munsach;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
/**
 *
 * @author NSPDL
 */
    public class sorBQL {
    public void sortByName(){
        Collections.sort(NhapBangQuanLi.BQL, new Comparator<BANGQL>(){
            public int compare(BANGQL t1,BANGQL t2){
                return t1.getTenBanDoc().compareToIgnoreCase(t2.getTenBanDoc());
            }
            });
    }
    public void sortByNum(){
        Collections.sort(NhapBangQuanLi.BQL, new Comparator<BANGQL>(){
            public int compare(BANGQL t1,BANGQL t2){
                int s1 = t1.getSoLuong(),s2 = t2.getSoLuong();
                if(s1 < s2){
                    return 1;
                } 
                if(s1 == s2){
                    return  0;
                }
                return -1;
            }
        });
    }
}
